package com.kfm.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogAdvice2 {

    // 根据注解进行 切入
    @Pointcut("@annotation(com.kfm.anno.M)")
    public void pt(){}

    @Around("pt()")
    public Object around(ProceedingJoinPoint proceedingJoinPoint){
        System.out.println(proceedingJoinPoint.getArgs()); // 传递的参数
        System.out.println(proceedingJoinPoint.getTarget()); // 代理对象
        System.out.println(proceedingJoinPoint.getSignature().getName()); // 方法

        return null;
    }
}
